// !@#$McCaBe-InStRuMeNtAtIoN$#@!
// Instrumented with the McCabe Java Parser
// Version: 8.1.0.1 - 20110309
// Using Path Vector Instrumentation
// Date: Sun Apr 01 2012 20:38:56
package Driver;

import EventManager.Request;
import EventManager.RequestStatus;
import EventManager.ViewAllEventsRequest;
import Model.Event;
import Service.OutputManager;

import com.mccabe.*;


class ViewAllEventsRequestView_1eae06477a3471e81e3a7018a052a954 {
    static java.lang.Object info[];
    static {
        info = new java.lang.Object[2];
        info[0] = new Integer(-1);
        info[1] = new String("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\Driver\\ViewAllEventsRequestView.java");
    }
}


/**
 * Views request list returned by ViewAllEventsRequest. Lots of room for extension here, but is not in the scope of this assignment.
 * @author Yury Kitaev
 *
 */
public class ViewAllEventsRequestView extends RequestView
{
	@Override
	public void view (Request r)
	{
int _mcFreq_88813417a4bdbd42ef0fc9d6d191cecf[] = new int[7];
PathVec_ERS_Iter3.enterMethod(ViewAllEventsRequestView_1eae06477a3471e81e3a7018a052a954.info,0,_mcFreq_88813417a4bdbd42ef0fc9d6d191cecf,0);

		ViewAllEventsRequest req = (ViewAllEventsRequest) r; // downcast
		
		OutputManager.println("\n*** Viewing request result of '".toUpperCase() + req.toString().toUpperCase() + "' ***");
		if (
PathVec_ERS_Iter3.decision(ViewAllEventsRequestView_1eae06477a3471e81e3a7018a052a954.info,0,_mcFreq_88813417a4bdbd42ef0fc9d6d191cecf,1,2,
PathVec_ERS_Iter3.testCondition(RequestStatus.Sustained == r.getStatus()
))
)
		{
			OutputManager.println("The request has been sustained.\n");
		}
		else if (
PathVec_ERS_Iter3.decision(ViewAllEventsRequestView_1eae06477a3471e81e3a7018a052a954.info,0,_mcFreq_88813417a4bdbd42ef0fc9d6d191cecf,3,4,
PathVec_ERS_Iter3.testCondition(RequestStatus.Pending == r.getStatus()
))
)
		{
			OutputManager.println("The request is pending.");
			endMessage();
			return;
		}
		else
		{
			OutputManager.println("The request has been refused.");
			endMessage();
			return;
		}
		
		OutputManager.println("Events returned: " + req.getEvents().size() + "\n");
		
{
for (Event e : req.getEvents())
		{
PathVec_ERS_Iter3.decision(ViewAllEventsRequestView_1eae06477a3471e81e3a7018a052a954.info,0,_mcFreq_88813417a4bdbd42ef0fc9d6d191cecf,5,0,true);

			OutputManager.println(e + "\n");
		}
PathVec_ERS_Iter3.decision(ViewAllEventsRequestView_1eae06477a3471e81e3a7018a052a954.info,0,_mcFreq_88813417a4bdbd42ef0fc9d6d191cecf,6,0,true);

}

		endMessage();
	}
	
	protected void endMessage()
	{
int _mcFreq_752bddaf1e4559307a3f5a67d45d81af[] = new int[1];
PathVec_ERS_Iter3.enterMethod(ViewAllEventsRequestView_1eae06477a3471e81e3a7018a052a954.info,1,_mcFreq_752bddaf1e4559307a3f5a67d45d81af,0);

		OutputManager.println("\n*** END OF VIEW ***");
	}
}
